/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 artifact_prop_spell_attack.h

	$Header: /heroes4/artifact_prop_spell_attack.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( ARTIFACT_PROP_SPELL_ATTACK_H_INCLUDED )
#define ARTIFACT_PROP_SPELL_ATTACK_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "artifact_prop_attack.h"
#include "artifact_prop_single_spell.h"

namespace t_artifact_prop
{
	// ----------------------------------------------------------------------
	// class for effects which cast spells with attacks
	// ----------------------------------------------------------------------
	class t_spell_with_attack_base : public t_single_spell, public t_attack
	{
	public:
		void init( t_spell spell, bool melee, bool ranged, int chance = 100 );

		virtual bool accept( t_artifact_effect_visitor& visitor );
		virtual bool read( std::streambuf& buffer );
		virtual bool write( std::streambuf& buffer ) const;
	};

	inline void t_spell_with_attack_base::init( t_spell spell, bool melee, bool ranged,
		                                        int chance )
	{
		t_single_spell::init( spell, k_artifact_target_hero, chance );
		m_affects_melee = melee;
		m_affects_ranged = ranged;
	}

	typedef t_effect< t_spell_with_attack_base, k_artifact_effect_spell_with_attack > t_spell_with_attack;

	inline t_spell_with_attack* get_spell_attack( t_spell spell, bool melee, bool ranged,
		                                          int chance = 100 )
	{
		return new t_spell_with_attack( spell, melee, ranged, chance );
	}
};

#endif // ARTIFACT_PROP_SPELL_ATTACK_H_INCLUDED